﻿define([
], function () {

    var controller = BackboneMVC.Controller.extend({
        name: 'userManager',
        show: function ($el) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/user/super/userManager' : 'views/crud/user/common/userManager'], function (View) {
                var view = new View();
                view.setElement($el);
                view.render();
            });
        },
        showEdit: function ($el, id) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/user/super/userEdit' : 'views/crud/user/common/userEdit'], function (View) {
                var view = new View();
                view.constructor({ userId: id });
                view.setElement($el);
                view.render();
            });
        },
        showEditPref: function ($el, id) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/user/super/userPrefEdit' : 'views/crud/user/common/userPrefEdit'], function (View) {
                var view = new View();
                view.constructor({ userId: id });
                view.setElement($el);
                view.render();
            });
        },
        addData: function ($el) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/user/super/userCreate' : 'views/crud/user/common/userCreate'], function (View) {
                var view = new View();
                view.setElement($el);
                view.render();
            });
        }
    });
    return controller;
});